//
//  WXPAuthProgressView.m
//  认证 - 顶部进度
//
//  Created by wxp on 2025/2/28.
//

#import "WXPAuthProgressView.h"

@implementation WXPAuthProgressView

#pragma mark - lazy
- (UIImageView *)imageTips
{
    if (_imageTips == nil) {
        _imageTips = [UIImageView  new];
        _imageTips.image = [UIImage imageNamed:@"icon-auth-progress-hint"];
        _imageTips.widthHeight = XY(Ratio(184), Ratio(26));
    }
    return  _imageTips;
}
- (UILabel *)numLabel
{
    if (_numLabel == nil) {
        _numLabel = [UILabel  new];
        _numLabel.textColor = COLOR_BLACK;
        _numLabel.font = [UIFont boldSystemFontOfSize:14];
    }
    return  _numLabel;
}
- (WXPAuthProgressMoneyView *)moneyView
{
    if (_moneyView == nil) {
        _moneyView = [WXPAuthProgressMoneyView  new];
    }
    return  _moneyView;
}

#pragma mark - 初始化
- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor clearColor];
        self.width = SCREEN_WIDTH;
        [self addSubView];
    }
    return self;
}

//添加subview
- (void)addSubView{
    [self addSubview:self.imageTips];
    [self addSubview:self.numLabel];
    [self addSubview:self.moneyView];
    //初始化页面
    [self resetViewWithNum:@"1"];
}

#pragma mark - 刷新view
- (void)resetViewWithNum:(NSString *)numStr{
    self.imageTips.leftTop = XY(LEFT_MARDIN, Ratio(10));
    [self.numLabel fitTitle:[NSString stringWithFormat:@"(%@/5)",numStr] variable:0];
    self.numLabel.rightCenterY = XY(SCREEN_WIDTH-self.imageTips.left, self.imageTips.centerY);
    self.moneyView.leftTop = XY(0, self.imageTips.bottom+Ratio(12));
    [self.moneyView resetViewWithAnimation];
    self.height = self.moneyView.bottom;
}

@end
